<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>Document</title>
    <style></style>
  </head>
  <body>
    <div>
      <h1>选择最优的循环方案</h1>
    </div>
    <script>
      //三中不同的循环-foreach优于for优于for-in
      var arrlist = new Array(1, 2, 3, 4, 5, 6, 7, 8, 9);

      arrlist.forEach(function (item) {
        console.log(item);
      });

      for (let i = 0, len = arrlist.length; i < len; i++) {
        console.log(arrlist[i]);
      }

      for (let i in arrlist) {
        console.log(arrlist[i]);
      }
    </script>
  </body>
</html>
